﻿using Core.Utility;

namespace ProcessControl.Model
{
    public class Data
    {
        public ulong Total { get; set; }

        public ulong NG { get; set; }
    }


    public class RwData
    {
        private Data data;

        private string Path;

        public ulong Total
        {
            get { return data.Total; }
            set { data.Total = value; Write(); }
        }
        public ulong NG
        {
            get { return data.NG; }
            set { data.NG = value; Write(); }
        }

        public RwData(string path)
        {
            data = new Data();
            Path = path;
        }

        public void Ini()
        {
            //判断文件夹是否存在不存在就创建文件夹
            data = SerializerXml<Data>.Read(Path);
        }
        public void Write()
        {
            SerializerXml<Data>.WriteObject(data, Path);
        }
    }
}
